package net.tarine.gastronomi.client.services;

import java.util.List;

import net.tarine.gastronomi.shared.AppConst;
import net.tarine.gastronomi.shared.DatabaseException;
import net.tarine.gastronomi.shared.EmptyResultException;
import net.tarine.gastronomi.shared.to.ForumMessageTo;
import net.tarine.gastronomi.shared.to.ForumThreadTo;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

/**
 * The client side stub for the RPC service.
 */
@RemoteServiceRelativePath(AppConst.SERVICE_FORUM)
public interface ForumService extends RemoteService {
	//thread
	public List<ForumThreadTo> findForumThreads(String gasId, Integer offset, Integer pageSize) throws DatabaseException, EmptyResultException;
	public ForumThreadTo findForumThreadById(String id) throws DatabaseException, EmptyResultException;
	public ForumThreadTo createForumThread(String gasId) throws DatabaseException;
	public Boolean deleteForumThread(String id) throws DatabaseException, EmptyResultException;
	
	//message
	public ForumThreadTo addForumThreadMessage(ForumThreadTo thread, ForumMessageTo message) throws DatabaseException;
	public ForumMessageTo findForumMessageById(String id) throws DatabaseException, EmptyResultException;
	public ForumMessageTo createForumMessage() throws DatabaseException;
	public Boolean deleteForumMessage(String id) throws DatabaseException, EmptyResultException;
	
	//Subscriptions
	public Boolean subscribeThread(String threadId, String gasUserId, boolean subscribed) throws DatabaseException;
	public List<String> findThreadSubscriberIds(String threadId) throws DatabaseException;
}
